package pl.squeaky.mvc.wizard;


import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class NewControllerNamePage extends WizardPage {

	private Combo cmbName;
	private Text txtSuperclass;

	protected NewControllerNamePage() {
		super("NewControllerNamePage");
		setTitle("New controller");
		setDescription("Choose controller name and superclass");
	}

	@Override
	public void createControl(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		GridLayout layout = new GridLayout(3, false);
		composite.setLayout(layout);
		setControl(composite);
		
		Label lblName = new Label(composite, SWT.NONE);
		lblName.setText("Controller name:");
		
		cmbName = new Combo(composite, SWT.None);
		cmbName.add("Error");
		GridData txtNameData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
		txtNameData.horizontalSpan = 2;
		cmbName.setLayoutData(txtNameData);
		cmbName.setFocus();
		
		Label lblSuperclass = new Label(composite, SWT.NONE);
		lblSuperclass.setText("Superclass:");
		
		txtSuperclass = new Text(composite, SWT.BORDER);
		txtSuperclass.setText("Zend_Controller_Action");
		txtSuperclass.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
		
		Button btnSuperclass = new Button(composite, SWT.PUSH);
		btnSuperclass.setText("Browse...");
		btnSuperclass.setLayoutData(new GridData(90, SWT.DEFAULT));
	}

	public String getControllerName() {
		return cmbName.getText();
	}
	
	public String getSuperclassName() {
		return txtSuperclass.getText();
	}
}
